<?php
require_once 'PHPUnit/Autoload.php';
require_once '../classes/C.php';

class CTest extends PHPUnit_Framework_TestCase
{
	public function testIncludeDir()
	{
		//resolvePath
		define('APP_PATH', '/app/');
		define('C_PATH', '/framework/');

		$this->assertEquals('/app/', C::resolvePath(''));
		$this->assertEquals('/app/', C::resolvePath('app'));
		$this->assertEquals('/framework/', C::resolvePath('c'));
		$this->assertEquals('/framework/some/path/', C::resolvePath('c.some.path'));

		C::addPathAlias('some', 'some.sub.path');
		$this->assertEquals('/app/some/sub/path/', C::resolvePath('some'));

		//includeDir
		$GLOBALS['variable'] = null;
		$GLOBALS['subDirVariable'] = null;

		C::includeDir('test_c_testIncludeDir', false);

		$this->assertEquals('ok', $GLOBALS['variable']);
		$this->assertNull($GLOBALS['subDirVariable']);
		
		C::includeDir('test_c_testIncludeDir');
		
		$this->assertEquals('ok', $GLOBALS['subDirVariable']);
	}
}
